#include "hello_opengl.h"

hello_opengl::hello_opengl(QWidget* parent)
	: QMainWindow(parent)
{
	ui.setupUi(this);
	setCentralWidget(ui.openGLWidget);

	connect(ui.act_draw_rect, &QAction::triggered, this, &hello_opengl::on_actDrawRect_triggered);
	connect(ui.act_clear, &QAction::triggered, this, &hello_opengl::on_actClear_triggered);
	connect(ui.actWireframe, &QAction::triggered, this, &hello_opengl::on_actWireframe_triggered);
}

hello_opengl::~hello_opengl()
{}

void hello_opengl::on_actDrawRect_triggered()
{
	ui.openGLWidget->drawShape(OpenGLWidget::Rect);
}

void hello_opengl::on_actClear_triggered()
{
	ui.openGLWidget->drawShape(OpenGLWidget::None);
}

void hello_opengl::on_actWireframe_triggered()
{
	ui.openGLWidget->setWireframe(ui.actWireframe->isChecked());
}